﻿using System;
using WeiSha.Core.Param.Method;

namespace WeiSha.Core
{
	// Token: 0x0200002A RID: 42
	public class Upload
	{
		// Token: 0x1700008B RID: 139
		// (get) Token: 0x0600016E RID: 366 RVA: 0x0000A644 File Offset: 0x00008844
		public static Upload Get
		{
			get
			{
				object @lock = Upload._lock;
				Upload get;
				lock (@lock)
				{
					bool flag2 = Upload._get == null;
					if (flag2)
					{
						Upload._get = new Upload();
					}
					get = Upload._get;
				}
				return get;
			}
		}

		// Token: 0x0600016F RID: 367 RVA: 0x0000A6A0 File Offset: 0x000088A0
		private Upload()
		{
			Upload.rootPath = PlatformInfoHandler.Node("Upload").Attribute("path");
		}

		// Token: 0x1700008C RID: 140
		// (get) Token: 0x06000170 RID: 368 RVA: 0x0000A6C4 File Offset: 0x000088C4
		public _Path Root
		{
			get
			{
				return new _Path(Upload.rootPath, "");
			}
		}

		// Token: 0x1700008D RID: 141
		public _Path this[string key]
		{
			get
			{
				bool flag = key == string.Empty || key == null || key.Trim() == "";
				_Path path;
				if (flag)
				{
					path = new _Path(Upload.rootPath, "");
				}
				else
				{
					string text = PlatformInfoHandler.Node("Upload").ItemValue(key);
					bool flag2 = string.IsNullOrWhiteSpace(text);
					if (flag2)
					{
						path = new _Path(string.Empty, text);
					}
					else
					{
						path = new _Path(Upload.rootPath, text);
					}
				}
				return path;
			}
		}

		// Token: 0x06000172 RID: 370 RVA: 0x0000A768 File Offset: 0x00008968
		public static string NameFilter(string str)
		{
			string text = "/\\\\:*?\"<>| \u3000";
			string text2 = text;
			for (int i = 0; i < text2.Length; i++)
			{
				str = str.Replace(text2[i].ToString(), "");
			}
			bool flag = str.Length > 255;
			if (flag)
			{
				str = str.Substring(0, 255);
			}
			return str;
		}

		// Token: 0x04000066 RID: 102
		private static Upload _get = null;

		// Token: 0x04000067 RID: 103
		private static readonly object _lock = new object();

		// Token: 0x04000068 RID: 104
		private static string rootPath;
	}
}
